<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>添加英雄</title>
</head>
<body>

<form class="layui-form" lay-filter="layui-form">
    <div class="mainBox">
        <div class="main-container">
            <div class="main-container">
                <blockquote class="layui-elem-quote">基础信息</blockquote>
                <div class="layui-form-item">
                    <label class="layui-form-label">
                        <text title="必填项" style="color:red;">*</text>
                        战法名称</label>
                    <div class="layui-input-block">
                        <input type="text" name="name" lay-verify="required" autocomplete="off" placeholder="请输入战法名称"
                               class="layui-input">
                    </div>
                </div>

                <div class="layui-form-item">
                    <text style="color:red;">图片尺寸建议 1:1比例</text>
                    <label class="layui-form-label">
                        <text title="必填项" style="color:red;">*</text>
                        战法图示</label>
                    <div class="layui-input-block">
                        <div class="laytpUpload"
                             data-name="icon"
                             data-dir="xm_game/sgz/war_methods/icon"
                             data-accept="image"
                             data-type="ali-oss"
                             data-layVerify="required"
                             data-showChoiceBtn="false"
                        ></div>
                    </div>
                </div>

                <div class="layui-form-item">
                    <text style="color:red;">图片尺寸建议 360*490比例</text>
                    <label class="layui-form-label">
                        <text title="必填项" style="color:red;">*</text>
                        战法大图</label>
                    <div class="layui-input-block">
                        <div class="laytpUpload"
                             data-name="picture"
                             data-dir="xm_game/sgz/war_methods/picture"
                             data-accept="image"
                             data-type="ali-oss"
                             data-layVerify="required"
                             data-showChoiceBtn="false"
                        ></div>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">
                        <text title="必填项" style="color:red;">*</text>
                        战法类型</label>
                    <div class="layui-input-inline">
                        <div class="xmSelect"
                             data-name="category"
                             data-sourceType="route"
                             data-source="/admin.sgz.war_methods/getCategory"
                             data-sourceTree="false"
                             data-paging="true"
                             data-valueField="category"
                             data-textField="category"
                             data-radio="true"
                             data-placeholder="请选择战法类型"
                        ></div>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">
                        <text title="必填项" style="color:red;">*</text>
                        战法品质</label>
                    <div class="layui-input-inline">
                        <div class="xmSelect"
                             data-name="level"
                             data-sourceType="data"
                             data-source="[{name:'S',value:'S'},{name:'A',value:'A'},{name:'B',value:'B'}]"
                             data-radio="true"
                             data-placeholder="请选择战法品质"
                        ></div>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">
                        <text title="必填项" style="color:red;">*</text>
                        战法来源</label>
                    <div class="layui-input-inline">
                        <div class="xmSelect"
                             data-name="form"
                             data-sourceType="data"
                             data-source="[{name:'自带战法',value:'1'},{name:'传承战法',value:'2'},{name:'事件战法',value:'3'}]"
                             data-radio="true"
                             data-placeholder="请选择战法来源"
                        ></div>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">
                        <text title="必填项" style="color:red;">*</text>
                        适用兵种</label>
                    <div class="layui-input-inline">
                        <div class="xmSelect"
                             data-name="arms"
                             data-sourceType="route"
                             data-source="/admin.sgz.war_methods/getArms"
                             data-sourceTree="false"
                             data-paging="true"
                             data-valueField="arm"
                             data-textField="arm"
                             data-placeholder="请选择适用兵种"
                        ></div>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label" title="自带武将">自带武将</label>
                    <div class="layui-input-inline">
                        <div class="xmSelect"
                             data-name="generals_one"
                             data-sourceType="route"
                             data-source="/admin.sgz.generals/index"
                             data-sourceTree="false"
                             data-paging="true"
                             data-valueField="id"
                             data-textField="name"
                             data-placeholder="请选择自带武将"
                        ></div>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label" title="传承武将">传承武将</label>
                    <div class="layui-input-inline">
                        <div class="xmSelect"
                             data-name="generals_two"
                             data-sourceType="route"
                             data-source="/admin.sgz.generals/index"
                             data-sourceTree="false"
                             data-paging="true"
                             data-valueField="id"
                             data-textField="name"
                             data-placeholder="请选择传承武将"
                        ></div>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">
                        <text title="必填项" style="color:red;">*</text>
                        效果冲突</label>
                    <div class="layui-input-block">
                        <input type="text" name="effect_conflict" lay-verify="required" autocomplete="off"
                               placeholder="请输入效果冲突"
                               class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">
                        <text title="必填项" style="color:red;">*</text>
                        战法效果</label>
                    <div class="layui-input-block">
                        <input type="text" name="methods_effect" lay-verify="required" autocomplete="off"
                               placeholder="请输入战法效果"
                               class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">
                        <text title="必填项" style="color:red;">*</text>
                        发动目标</label>
                    <div class="layui-input-block">
                        <input type="text" name="methods_target" lay-verify="required" autocomplete="off"
                               placeholder="请输入发动目标"
                               class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">
                        <text title="必填项" style="color:red;">*</text>
                        发动概率</label>
                    <div class="layui-input-block">
                        <input type="text" name="launch_probability" lay-verify="required" autocomplete="off"
                               placeholder="请输入发动概率"
                               class="layui-input">
                    </div>
                </div>

                <div class="layui-form-item layui-form-text">
                    <label class="layui-form-label">
                        <text style="color:red;">*</text>
                        战法说明</label>
                    <div class="layui-input-block">
                        <textarea placeholder="请输入战法说明" name="methods_description" class="layui-textarea"
                                  lay-verify="required"></textarea>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="bottom">
        <div class="button-container">
            <button type="submit" class="laytp-btn laytp-btn-primary laytp-btn-sm" lay-submit="" lay-filter="add">
                <i class="layui-icon layui-icon-ok"></i>
                提交
            </button>
            <button type="reset" class="laytp-btn laytp-btn-sm">
                <i class="layui-icon layui-icon-refresh"></i>
                重置
            </button>
        </div>
    </div>
</form>
<script>
    if (localStorage.getItem("staticDomain")) {
        document.write("<link rel='stylesheet' href='" + localStorage.getItem("staticDomain") + "/component/layui/css/layui.css?v=" + localStorage.getItem("version") + "'>");
        document.write("<script src='" + localStorage.getItem("staticDomain") + "/component/layui/layui.js?v=" + localStorage.getItem("version") + "'><\/script>");
        document.write("<script src='" + localStorage.getItem("staticDomain") + "/component/laytp/layuiConfig.js?v=" + localStorage.getItem("version") + "'><\/script>");
        document.write("<script src='" + localStorage.getItem("staticDomain") + "/component/jquery_3.3.1.js?v=" + localStorage.getItem("version") + "'><\/script>");
        document.write("<script src='" + localStorage.getItem("staticDomain") + "/component/jquery.tablednd.js?v=" + localStorage.getItem("version") + "'><\/script>");
    } else {
        document.write("<link rel='stylesheet' href='/static/component/layui/css/layui.css?v=" + localStorage.getItem("version") + "'>");
        document.write("<script src='/static/component/layui/layui.js?v=" + localStorage.getItem("version") + "'><\/script>");
        document.write("<script src='/static/component/laytp/layuiConfig.js?v=" + localStorage.getItem("version") + "'><\/script>");
        document.write("<script src='/static/component/jquery_3.3.1.js?v=" + localStorage.getItem("version") + "'><\/script>");
        document.write("<script src='/static/component/jquery.tablednd.js?v=" + localStorage.getItem("version") + "'><\/script>");
    }
</script>
<script>
    layui.use(['laytp'], function () {
        layui.form.on('submit(add)', function (data) {
            var btnAnim = layui.button.load({elem: $(this)});
            facade.ajax({
                route: '/admin.sgz.war_methods/add',
                data: data.field
            }).done(function (res) {
                if (res.code === 0) {
                    parent.layui.layer.close(parent.layui.layer.getFrameIndex(window.name));//关闭当前页
                    parent.layui.table.reload("laytp-table");
                }
                btnAnim.stop();
            }).fail(function () {
                btnAnim.stop();
            });
            return false;
        });
    })
</script>
</body>
</html>